import 'package:flutter/material.dart';
import 'package:flutter_swiper/flutter_swiper.dart';
import '../res/listData.dart';
// 直接引插件  pub.dev   -> flutter_swiper
class SwiperPage extends StatefulWidget {
  SwiperPage({Key key}) : super(key: key);

  _SwiperPageState createState() => _SwiperPageState();
}

class _SwiperPageState extends State<SwiperPage> {
 
  @override
  Widget build(BuildContext context) {
    return Scaffold(
         appBar: AppBar(
           title: Text("SwiperPage"),
         ),
         body: Column(
           children: <Widget>[
             Container(
               width: double.infinity,
               child: AspectRatio(
                 aspectRatio: 16/9,
                 child: Swiper(
                    itemBuilder: (BuildContext context, int index) {
                        return new Image.network(
                          listData[index]['imageUrl'],
                          fit: BoxFit.fill,
                        );
                      },
                      itemCount: listData.length,
                      control:new SwiperControl(),
                      pagination:new SwiperPagination()
                  ),
                  
               ),
             )
           ],
         )
       );
  }
}